﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ExpenseSystem.Common;
using ExpenseSystem.Common.BaseModel;
using ExpenseSystem.DataUpdater;
using ExpenseSystem.Fether;
using ExpenseSystem.Model;
using ExpenseSystem.Core.DataAddOn;
using System.Web;

namespace ExpenseSystem.Core.RoleModules
{
    public abstract class RoleManager:ISystemManager<RoleModel>,ISystemManager<RoleUserModel>,ISystemManager<RoleSiteModel>,ISystemManager<RoleModuleModel>
    {
        protected string tran = HttpContext.Current.Items[Definition.SESSION_TRAN_STR].ToString();

        protected RoleManager() { }
        public static RoleManager CreateInstance()
        {
            return new RoleBaseManager();
        }
        protected SystemDataUpdater<RoleModel> roleUpdater = new RoleUpdaterRegister().GetRoleUpdater();
        protected SystemDataUpdater<RoleModuleModel> roleModuleUpdater = new RoleUpdaterRegister().GetModuleRoleUpdater();
        protected SystemDataUpdater<RoleSiteModel> roleSiteUpdater = new RoleUpdaterRegister().GetSiteRoleUpdater();
        protected SystemDataUpdater<RoleUserModel> roleUserUpdater = new RoleUpdaterRegister().GetUserRoleUpdater();

        public abstract bool Delete(RoleModel role,  out string message);
        public abstract bool DeleteById(long[] siteId, out string message);
        public abstract bool Save(RoleModel role, out string message,params IAddable<RoleModel>[] addables);

        public abstract bool Save(RoleModuleModel moduleRole,  out string message, params IAddable<RoleModuleModel>[] addables);
        public abstract bool Save(RoleSiteModel siteRole,  out string message, params IAddable<RoleSiteModel>[] addables);
        public abstract bool Save(RoleUserModel userRole,  out string message, params IAddable<RoleUserModel>[] addables);
        public abstract bool Delete(RoleModuleModel moduleRole,  out string message);
        public abstract bool Delete(RoleSiteModel siteRole,out string message);
        public abstract bool Delete(RoleUserModel userRole,  out string message);
    }
}
